<template>
    <div>
        <x-header :left-options="{backText: ''}" ref="hb">意见反馈</x-header>
        <group title="请在下面填写您的意见和建议">
            <x-textarea v-model="feedback"></x-textarea>
        </group>
        <div style="padding:0 15px;color:#ff563c;margin-top:10px">添加图片说明</div>
        <grid>
            <grid-item v-for="(img,index) in imgList" @click.native="clickImg(index,img)">
                <img slot="icon" :src="img.src">
            </grid-item>
        </grid>
        <actionsheet v-model="showAct" :menus="menus" theme="android" @on-click-menu="clickMenu"></actionsheet>
        <button class="own-login__btn" style="margin-bottom: 20px;" @click.stop="saveFeedBack" disabled>提交</button>
    </div>
</template>

<script>
import XHeader from 'vux/src/components/x-header/index.vue'
import Group from 'vux/src/components/group/index.vue'
import XTextarea from 'vux/src/components/x-textarea/index.vue'
import Actionsheet from 'vux/src/components/actionsheet/index.vue'
import {Grid, GridItem} from 'vux/src/components/grid'


export default{
    components:{
        XHeader,
        Group,
        XTextarea,
        Grid,
        GridItem,
        Actionsheet
    },
    data(){
        return{
            wxSDK:{},
            feedback:'',
            imgList:[
                {
                    src:'',
                    isClickAdd:true,
                    serverId:''
                }
            ],
            num:9,
            serverIds:[],
            showAct:false,
            menus:[
                {
                    label:'删除',
                    type:'warn',
                    value:'1'
                }
            ],
            index:0
        }
    },
    created(){
    },
    methods:{
        getImgs(){

        },
        syncUpload(localIds){
        },
        clickImg(index,img){
            if(img.isClickAdd){
                this.getImgs();
            }else{
                this.showAct = true;
                this.index = index;
            }
        },
        clickMenu(){
            let _this = this;
            _this.imgList.splice(_this.index,1);
        },
        saveFeedBack(){
            let _this = this;
            let feedback = _this.feedback;
            if(feedback != ''){
                _this.$vux.loading.show();
                let serverIds = [];
                for(let item of _this.imgList){
                    let img = {};
                    img.serverId = item.serverId;
                    img.token = _this.wxSDK.accessToken;
                    serverIds.push(img);
                }
                let imgs = {};
                imgs.list = serverIds;
            }else{
                _this.$vux.toast.show({
                    type:'warn',
                    text: '请输入内容',
                })
            }
        }
    }
}
</script>

<style lang="less">

</style>
